//
//  Emoticon.swift
//  表情键盘
//
//  Created by 李国伟 on 15/12/15.
//  Copyright © 2015年 李国伟. All rights reserved.
//

import UIKit

class Emoticon: NSObject {

    ///  发送给服务器的表情
    var chs: String?
    
    //本地图片名称
    var png: String?
    
    ///  本地图片路径
    var imagePath : String {
        
        if png == nil {
            return ""
        }
//        let path = NSBundle.mainBundle().pathForResource("emoticons.plist", ofType: nil, inDirectory: "Emoticons.bundle")!

        return NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + png!
    }
    
    /// emoji 的字符串编码
    var code: String? {
        didSet {
            emoji = code?.emoji
        }
    }
    /// emoji 的字符串
    var emoji: String?
    
    //设置默认为空
    var isEmpy = false
    
    init(isEmpy: Bool) {
        self.isEmpy = isEmpy
    }
    
    //默认不删除
    var isRemove = false
    
    init(isRemove: Bool ) {
        self.isRemove = isRemove
    }
    
    init(dict: [String : AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    //重写
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    
    override var description: String {
        
        let key = ["chs","png","imagePath","isEmpy","isRemove"]
        return dictionaryWithValuesForKeys(key).description
    }
}
